package asteroids.statements;


import java.util.List;

import be.kuleuven.cs.som.annotate.Basic;

public abstract class ComposedStatement extends Statement {

	protected ComposedStatement(int line, int column) {
		super(line, column);
	}

	@Override
	public boolean hasAsSubStatement(Statement statement) {
		if (statement == this)
			return true;
		for (int pos = 1; pos <= getNbOfStatements(); pos++)
			if (getStatementAt(pos).hasAsSubStatement(statement))
				return true;
		return false;
	}
	
	@Override
	public boolean hasSubstatement() {
		return true;
	}
	
	@Override
	public boolean hasActionStatement() {
		boolean actionOccurred = false;
		for(int i=1; i <= getNbOfStatements(); i++){
			actionOccurred = actionOccurred || getStatementAt(i).hasActionStatement();
		}
		return actionOccurred;
	}
}
